// 商品属性相关的api
import request from "@/utils/request";

// 获取商品一级分类
export const apiGetCategory1 = ()=> request.get('/admin/product/getCategory1')


// 获取商品二级分类
export const apiGetCategory2 = (category1Id)=>request.get(`/admin/product/getCategory2/${category1Id}`)

// 获取商品三级分类
export const apiGetCategory3 =category2Id=>request.get(`/admin/product/getCategory3/${category2Id}`)

// 获取商品属性信息 category1Id ; category2Id ; category3Id
export const apiGetAttrs = (category1Id,category2Id,category3Id)=>request.get(`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`)

// 添加商品属性 attr:
/*{
     attrName: '商品属性名称',
     attrValueList: [
     {attrId: '属性的Id', valueName: '属性值的名称'}
     ],
     categoryId: '三级分类的Id',
     categoryLevel: '3'
   }**/
export const apiAddAttr = attr=>request({method: 'POST',url:'/admin/product/saveAttrInfo',data: attr})

// 删除商品的属性
export const apiDeleteAttr = attrId=>request.delete(`/admin/product/deleteAttr/${attrId}`)
